import { EggAppConfig, EggAppInfo, PowerPartial } from "egg";

export default (appInfo: EggAppInfo) => {
  const config = {} as PowerPartial<EggAppConfig>;

  // override config from framework / plugin
  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + "_1694849194173_5738";

  // add your egg config in here
  config.middleware = [];

  config.security = {
    csrf: {
      enable: false,
    },
    domainWhiteList: [
      "http://localhost:8000",
      "http://localhost:8001",
      "http://192.168.0.14:8000",
      "http://192.168.0.108:8000",
      "http://192.168.0.166:8000",
      "http://192.168.0.14:8024",
      "https://ccj.cpolar.top",
    ],
  };

  // add your special config in here
  const bizConfig = {
    jwt: {
      // 密钥：由43位大小写字数和数字组成。
      SECRET: "yLuYYVOP0NtQyI6N03evUx7bcBF2JCmE6T47gMERR3B",
    },
  };

  // the return config will combines to EggAppConfig
  return {
    ...config,
    ...bizConfig,
  };
};
